#!/bin/bash

#1.configuratin ip address
config_ip(){
	read -p "please input you want ip address:" ip_add
	read -p "please input you want netmask:" netmask
	read -p "please input you want gateway:" gateway
	read -p "please inpu you want DNS1:" dns
	ip_dir=`ls /etc/sysconfig/network-scripts/ifcfg-e*`
	echo ${ip_dir[*]}
	wi_dir=`echo ${dir[0]}`
	cat >>$wi_dir<<EOF
IPADDR=$ip_add
NETMASK=$netmask
GATEWAY=$gateway
DNS1=$dns
EOF

	sed -ir "s/^ONBOOT=no/ONBOOT=yes/g" $wi_dir
	sed -ir "s/^BOOTPROTO=dhcp/BOOTPROTO=none/g" $wi_dir
	service network restart
	ip addr
	ping -c 4 www.baidu.com
	if [ $? == 0 ];then
		echo "the network is nomal"
	fi 
}

#2.

yum install vim -y 

yum install lsof -y

yum install psmisc -y

yum install httpd -y

iptables -F
systemctl disable firewalld.service

setenforce 0
getenforce 

sed -ir "s/^SELINUX=enforcing/SELINUX=disabled/g" /etc/sysconfig/selinux 
cat /etc/sysconfig/selinux |grep "^SELINUX"

yum install mariadb mariadb-server -y

